package com.aizhixin.lab.task.repository;

import com.aizhixin.lab.task.domain.TaskQuestionChoiceDomain;
import com.aizhixin.lab.task.entity.TaskQuestionChoice;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;


public interface TaskQuestionChoiceRepository extends JpaRepository<TaskQuestionChoice, String> {
	
	List<TaskQuestionChoice> findAllByDeleteFlagAndTaskQuestionId(Integer deleteFlag,String taskQuestionId);
	
    List<TaskQuestionChoice> findByDeleteFlagAndTaskQuestionIdIn(Integer deleteFlag,List<String> taskQuestionIds);
	
	@Query("select new com.aizhixin.lab.task.domain.TaskQuestionChoiceDomain(w.id,w.option,w.choiceContent,w.taskQuestionId) from com.aizhixin.lab.task.entity.TaskQuestionChoice w where w.deleteFlag=:deleteFlag and w.taskQuestionId=:taskQuestionId order by w.option")
	public List<TaskQuestionChoiceDomain> findAll(@Param("deleteFlag")Integer deleteFlag,@Param("taskQuestionId")String taskQuestionId);
	
}
